package com.ywu.application.standard.wiki.api;

import com.ywu.common.result.CommonResult;
import com.ywu.application.standard.wiki.dto.YwuWikiDocDto;
import com.ywu.application.standard.wiki.dto.YwuWikiProjectDto;
import com.ywu.application.standard.wiki.service.YwuWikiDocService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @ClassName YwuWikiDocApi
 * @Description TODO
 * @Author GroundDemo
 * @Date 2024/9/20 20:35
 * @Version 1.0
 **/
@RestController
@RequestMapping("/ywu/wiki/doc")
public class YwuWikiDocApi {
    @Autowired
    private YwuWikiDocService service;

    /**
    * @Author GroundDemo
    * @Description 添加WIKI文档
    * @Date 17:09 2024/9/21
    * @Param []
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/create.wiki.doc.info")
    public CommonResult<Object> createDoc(@RequestBody YwuWikiDocDto ywuWikiDocDto) {
        return service.createDoc(ywuWikiDocDto);
    }

    /**
    * @Author GroundDemo
    * @Description 更新WIKI文档
    * @Date 17:18 2024/9/21
    * @Param [ywuWikiDocDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/update.wiki.doc.info")
    public CommonResult<Object> updateDoc(@RequestBody YwuWikiDocDto ywuWikiDocDto) {
        return service.updateDoc(ywuWikiDocDto);
    }

    /**
    * @Author GroundDemo
    * @Description 删除文档数据
    * @Date 17:46 2024/9/21
    * @Param [ywuWikiDocDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/delete.wiki.doc.info")
    public CommonResult<Object> deleteDoc(@RequestBody YwuWikiDocDto ywuWikiDocDto) {
        return service.deleteDoc(ywuWikiDocDto);
    }

    /**
    * @Author GroundDemo
    * @Description 分页查询文档数据
    * @Date 17:51 2024/9/21
    * @Param [ywuWikiDocDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/query.wiki.doc.page.list")
    public CommonResult<Object> queryPageList(@RequestBody YwuWikiDocDto ywuWikiDocDto) {
        return service.queryPageList(ywuWikiDocDto);
    }

    /**
    * @Author GroundDemo
    * @Description 根据文档ID查询文档数据
    * @Date 17:59 2024/9/21
    * @Param [ywuWikiDocDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/query.wiki.doc.by.id.info")
    public CommonResult<Object> queryDocById(@RequestBody YwuWikiDocDto ywuWikiDocDto) {
        return service.queryDocById(ywuWikiDocDto);
    }

    /**
    * @Author GroundDemo
    * @Description 文档发布
    * @Date 9:25 2024/9/22
    * @Param [ywuWikiDocDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/publish.wiki.doc.info")
    public CommonResult<Object> publishDoc(@RequestBody YwuWikiDocDto ywuWikiDocDto) {
        return service.publishDoc(ywuWikiDocDto);
    }

    /**
    * @Author GroundDemo
    * @Description wiki文档上传图片
    * @Date 13:27 2024/9/28
    * @Param [file]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/upload.wiki.doc.image")
    public CommonResult<Object> uploadWikiFileImage(@RequestParam("file") MultipartFile file) {
        return service.uploadWikiFileImage(file);
    }

    /**
    * @Author GroundDemo
    * @Description 根据项目ID查询项目下的所有文档并构建树形目录
    * @Date 10:59 2024/9/29
    * @Param [ywuWikiProjectDto]
    * @return com.ywu.common.result.CommonResult<java.lang.Object>
    **/
    @PostMapping("/query.wiki.doc.tree.list")
    public CommonResult<Object> queryDocTreeListByProjectId(@RequestBody YwuWikiProjectDto ywuWikiProjectDto) {
        return service.queryDocTreeListByProjectId(ywuWikiProjectDto);
    }
}
